checkCookie($t_ship_cookie, $db); # ########################################################################## # # printDerivedData # # ########################################################################## # function printDerivedData ($cargotype, $cargo) { global $db; /* Print the top of the html output page and the start of the table */ printTableTop($cargotype); /* Need to get all the data from the saved journey info which belongs to * derived data set for this particular cargo type and cargo. Will need to * get data from more than one table. */ $cargo = urldecode($cargo); /* dodgy hack to output only coal instead of 'coal' and 'coal (saf)' for Bill 1/9/00 - Aydin */ if ($cargo == "COAL") { # $cargostr = "(t2.cargo ~* 'COAL' OR t2.cargo ~* 'COAL (Saf)')"; $cargostr = "(t2.cargo = 'COAL' OR t2.cargo = 'COAL (Saf)')"; } else { # $cargostr = "t2.cargo ~* '$cargo'"; $cargostr = "t2.cargo = '$cargo'"; } $query = "SELECT t1.*, t2.trans_id FROM saved_general_info t1, saved_cargo_info t2, frp_priorities p WHERE t1.member_id = 0 AND t1.type = '$cargotype' AND $cargostr AND t1.trans_id = t2.trans_id AND t1.trans_id = p.trans_id ORDER BY p.priority"; $sth = pg_exec($db, $query); $row = 0; $rows = $sth != FALSE ? PG_NUMROWS($sth) : 0; // Go through the derived data set while ($row < $rows) { /* Get the data from the general table */ $data = pg_fetch_object ($sth, $row); /* Need to get the rest of the data (with this trans_id) from the other tables * start with the journey table */ //$query = "SELECT * FROM saved_journey_info WHERE trans_id = $data->trans_id"; $query = "SELECT j.fr_spot, j.fr_2, j.fr_3, j.fr_4, tdd.tcr_spot, tdd.tcr_2, tdd.tcr_3, tdd.tcr_4 FROM saved_journey_info j, derived_data_tcr_data tdd WHERE j.trans_id = $data->trans_id AND tdd.date_stamp = 'today' AND j.tcr_ref = tdd.id"; $sth2 = pg_exec($db, $query); /* Get the data from the port table */ $query = "SELECT * FROM saved_port_info WHERE trans_id = $data->trans_id ORDER BY num ASC"; $sth3 = pg_exec($db, $query); /* Get the data from the cargo table */ $query = "SELECT * FROM saved_cargo_info WHERE trans_id = $data->trans_id"; $sth4 = pg_exec($db, $query); /* Now need to print the data out. */ printTableRow($cargotype, $data, $sth2, $sth3, $sth4); $row++; } // end while /* output the datestamp of the latest output to give an indication of last updated date... */ $datedb = pg_exec($db, "SELECT to_char(datestamp,'Dy DD Mon YYYY, HH:MIam') AS date FROM saved_journey_info LIMIT 1"); $date_data = pg_fetch_object($datedb, 0); $datestamp = $date_data->date; echo "last updated ".$datestamp."   \n"; /* Print the end of the table and the bottom of the html page */ printTableBottom(); } // end printDerivedData ?>

freight rate portfolios


=3) && ($mon<=5)) { $fwd1 = 6; $fwd2 = 9; $fwd3 = 0; } else if (($mon>=6) && ($mon<=8)) { $fwd1 = 9; $fwd2 = 0; $fwd3 = 3; } else if (($mon>=9) && ($mon<=11)) { $fwd1 = 0; $fwd2 = 3; $fwd3 = 6; } else if (($mon>=0) || ($mon<=2)) { $fwd1 = 3; $fwd2 = 6; $fwd3 = 9; } // Determine what additional table headings we require for either dry/wet/gas if ($cargo_type == 'dry' || $cargo_type == 'gas') { $rate = "VoyRt"; } else { $rate = "WSR"; } ?> Cargo -

Vessel Cargo size Load Discharge Laytime TCE/
$rate") ?>
TCE/
$rate") ?>
TCE/
$rate") ?>
TCE/
$rate") ?>
name ?> intake ?> mt name ?> name ?> load_daytype_text; $disch_daytype = $cargo_data->dischg_daytype_text; if ($load_daytype == 'Shinc') $load_daytype = 'SC'; if (($load_daytype == 'Shex') || ($load_daytype == 'SatShex') || ($load_daytype == 'SatpmShex')) $load_daytype = 'SX'; if ($load_daytype == 'Fhinc') $load_daytype = 'FH'; if ($load_daytype == 'Fhex') $load_daytype = 'FX'; if (($load_daytype == 'ThuFhex') || ($load_daytype == 'ThupmFhex')) $load_daytype = 'TX'; if ($disch_daytype == 'Shinc') $disch_daytype = 'SC'; if (($disch_daytype == 'Shex') || ($disch_daytype == 'SatShex') || ($disch_daytype == 'SatpmShex')) $disch_daytype = 'SX'; if ($disch_daytype == 'Fhinc') $disch_daytype = 'FH'; if ($disch_daytype == 'Fhex') $disch_daytype = 'FX'; if (($disch_daytype == 'ThuFhex') || ($disch_daytype == 'ThupmFhex')) $disch_daytype = 'TX'; if ($cargo_data->load_rate_unit == 'totaldays' || $cargo_data == 'totalhours') { $load_rate = 2 * $cargo_data->load_rate; $load_rate_text = "$load_rate $cargo_data->load_rate_unit $load_daytype"; } else { $load_rate_text = "$cargo_data->load_rate $cargo_data->load_rate_unit $load_daytype / $cargo_data->dischg_rate $cargo_data->dischg_rate_unit $disch_daytype"; } print "$load_rate_text"; // Get the fwd months $tcr_spot = $journey_data->tcr_spot; $tcr_2 = $journey_data->tcr_2; $tcr_3 = $journey_data->tcr_3; $tcr_4 = $journey_data->tcr_4; if ($cargo_type == "gas" || $cargo_type == "dry") { $spot = number_format($journey_data->fr_spot,2); $fwd1 = number_format($journey_data->fr_2,2); $fwd2 = number_format($journey_data->fr_3,2); $fwd3 = number_format($journey_data->fr_4,2); } else { $spot = ($journey_data->fr_spot / $port_data->ws_flat) * 100; $fwd1 = ($journey_data->fr_2 / $port_data->ws_flat) * 100; $fwd2 = ($journey_data->fr_3 / $port_data->ws_flat) * 100; $fwd3 = ($journey_data->fr_4 / $port_data->ws_flat) * 100; $spot = round($spot); $fwd1 = round($fwd1); $fwd2 = round($fwd2); $fwd3 = round($fwd3); } ?> " . $spot ?> " . $fwd1 ?> " . $fwd2 ?> " . $fwd3 ?>

[back]